package com.wva.video.domain.dto;

import com.wva.common.constant.PatternConst;
import lombok.Data;
import org.hibernate.validator.constraints.Range;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;

/**
 * @Author: hong
 * @Date: 2025/2/16 22:55:38
 */
@Data
public class VideoSubmissionDTO {
    @NotEmpty(message = "标题不能为空")
    @Size(min = 1, max = 30, message = "标题必须是在1~30个字符")
    private String title;

    @NotNull(message = "必须选择原创或转载类型")
    @Range(min = 0, max = 1, message = "不存在的类型")
    private Integer type;

    //*需代码里校验分类是否存在
    @NotNull(message = "请选择视频分类")
    private Long categoryId;

    //可以为空
    private String description;

    //*type为1则需要校验
    @NotEmpty(groups = Repost.class, message = "转载链接不能为空")
    @Pattern(regexp = PatternConst.URL, message = "转载链接不符合网址格式", groups = Repost.class)
    private String repostUrl;

    //*可以为空，标签长度需额外校验
    @Size(max = 10, message = "最多添加10个标签")
    private String[] tags;

    @NotEmpty
    @Pattern(regexp = PatternConst.MD5)
    private String fileMd5;

    //分组
    public interface Repost {}
}
